class DDOauthModel {
  String? token;
  bool? isFirstRegister;
  DDUserInfoModel? userinfo;

  DDOauthModel({
    this.token,
    this.isFirstRegister,
    this.userinfo,
  });

  factory DDOauthModel.fromJson(Map<String, dynamic> json) {
    return DDOauthModel(
      token: json['token'] as String?,
      isFirstRegister: json['isFirstRegister'] as bool?,
      userinfo: json['userInfo'] != null
          ? DDUserInfoModel.fromJson(json['userInfo'])
          : null,
    );
  }
}

class DDUserInfoModel {
  String? userId;
  String? avatarUrl;
  String? avatarMiddleThumbUrl;
  String? avatarThumbUrl;

  int? gender;
  String? nickname;
  int? age;
  String? birthday;
  String? country;
  String? about;
  int? availableCoins;

  DDUserInfoModel({
    this.userId,
    this.avatarUrl,
    this.avatarMiddleThumbUrl,
    this.avatarThumbUrl,
    this.gender,
    this.nickname,
    this.age,
    this.birthday,
    this.country,
    this.about,
    this.availableCoins,
  });

  factory DDUserInfoModel.fromJson(Map<String, dynamic> json) {
    return DDUserInfoModel(
      userId: json['userId'] ?? '',
      avatarUrl: json['avatarUrl'] ?? '',
      avatarMiddleThumbUrl: json['avatarMiddleThumbUrl'] ?? '',
      avatarThumbUrl: json['avatarThumbUrl'] ?? '',
      gender: json['gender'] ?? 0,
      nickname: json['nickname'] ?? '',
      age: json['age'] ?? 0,
      birthday: json['birthday'] ?? '',
      country: json['country'] ?? '',
      about: json['about'] ?? '',
      availableCoins: json['availableCoins'] ?? 0,
    );
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = new Map<String, dynamic>();
    data['userId'] = this.userId;
    data['avatarUrl'] = this.avatarUrl;
    data['avatarMiddleThumbUrl'] = this.avatarMiddleThumbUrl;
    data['avatarThumbUrl'] = this.avatarThumbUrl;
    data['gender'] = this.gender;
    data['nickname'] = this.nickname;
    data['age'] = this.age;
    data['birthday'] = this.birthday;
    data['country'] = this.country;
    data['about'] = this.about;
    data['availableCoins'] = this.availableCoins;
    return data;
  }
}
